<%@ page language="java" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>My JSP 'storageShow.jsp' starting page</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<style type="text/css">
body,td,th {
	font-size: 12px;
}
</style>
		<script type="text/javascript">
			function save()
			{
				document.getElementById("storageForm").action = "<%=request.getContextPath()%>/storage/saveForStorageJump.action";
				document.getElementById("storageForm").submit();
			}
			
			function updateStorage()
			{
				var selectVal = selectStorageid();
				if(selectVal.length == 0)
				{
					alert("请选择需要修改的数据");
				}
				else
				{
					var index = selectVal.indexOf("~");
					if(index > 0)
					{
						alert("每次只能修改一条数据");
					}
					else
					{
						alert("<%=request.getContextPath()%>/storage/updateForStorageJump.action?storageid=" + selectVal);
						document.getElementById("storageForm").action = "<%=request.getContextPath()%>/storage/updateForStorageJump.action?storageid=" + selectVal;
						document.getElementById("storageForm").submit();
					}
				}
				
			}
			
			function deleteStorage()
			{
				var selectVal = selectStorageid();
				if(selectVal.length == 0)
				{
					alert("请选择需要修改的数据");
				}
				else
				{
					document.getElementById("storageForm").action = "<%=request.getContextPath()%>/storage/deleteForStorage.action?storageid=" + selectVal;
					document.getElementById("storageForm").submit();
				}
			}
			
			function showStorage()
			{
				var selectVal = selectStorageid();
				if(selectVal.length == 0)
				{
					alert("请选择需要查看的数据");
				}
				else
				{
					var index = selectVal.indexOf("~");
					if(index > 0)
					{
						alert("每次只能修改一条数据");
					}
					else
					{
						document.getElementById("storageForm").action = "<%=request.getContextPath()%>/storage/showForStorage.action?storageid=" + selectVal;
						document.getElementById("storageForm").submit();
					}
				}
			}
			
			function selectStorageid()
			{
				var storageid = document.getElementsByName("storageid");
				var selectVal = "";
				for(var i = 0 ; i < storageid.length; i++)
				{
					if(storageid[i].checked)
					{
						if(selectVal.length == 0)
						{
							selectVal = selectVal + storageid[i].value;
						}
						else
						{
							selectVal = selectVal + "~" + storageid[i].value;
						}
					}
				}
				return selectVal;
			}
		</script>
	</head>

	<body>
		<form name="storageForm" method="post" id="storageForm" action="<%=request.getContextPath() %>/storage/queryForStorageList.action">
			<table width="80%" border="1" align="center" cellpadding="1"
				cellspacing="1">
				<tr>
					<td width="15%" height="25">
						品名：
					</td>
					<td width="35%" height="25" align="center">
						<input name="storageParameBean.commodity" type="text"
							id="commodity" style="width: 98%" value="${storageParameBean.commodity }">
					</td>
					<td width="15%" align="center">
						生产指令单号：
					</td>
					<td width="47%" align="center">
						<input name="storageParameBean.ordernumber" type="text"
							id="ordernumber" style="width: 98%" value="${storageParameBean.ordernumber }">
					</td>
				</tr>
				<tr>
					<td height="25" colspan="4" align="right">
						<input type="submit" name="Submit" value="查询">
					</td>
				</tr>
			</table>
			<p>
				&nbsp;

			</p>
			<table width="80%" border="1" align="center" cellpadding="1"
				cellspacing="1">
				<tr align="center">
					<td height="25" colspan="9" align="right">
						<input type="button" value="新增" onClick="save()">
						<input type="button" value="删除" onClick="deleteStorage()">
					</td>
				</tr>
				<tr align="center">
					<td rowspan="2">
						<input type="checkbox" name="checkbox" value="checkbox">
					</td>
					<td height="25" rowspan="2">
						编号
					</td>
					<td height="25" rowspan="2">
						品名
					</td>
					<td height="25" rowspan="2">
						生产指令单号
					</td>
					<td height="25" colspan="2">
						规格
					</td>
					<td rowspan="2">
						入库数量
					</td>
					<td rowspan="2">
						计量单位
					</td>
					<td height="25" rowspan="2">
						入库时间
					</td>
				</tr>
				<tr>
					<td height="25" align="center">
						亮度
					</td>
					<td height="25" align="center">
						色温
					</td>
				</tr>
				<c:forEach var="storageList" varStatus="storageListCount"
					items="${storageList}">
					<tr align="center">
						<td>
							<input type="checkbox" name=storageid
								value="${storageList.storageid }">
						</td>
						<td height="25">
							${storageListCount.count }
						</td>
						<td height="25">
							${storageList.commodity }
						</td>
						<td height="25">
							${storageList.ordernumber }
						</td>
						<td height="25">
							${storageList.brightness }
						</td>
						<td height="25">
							${storageList.colortemperature }
						</td>
						<td>
							${storageList.storagenumber }
						</td>
						<td>
							${storageList.measurementid }
						</td>
						<td height="25">
							${storageList.storagetime }
						</td>
					</tr>
				</c:forEach>
				<c:if test="${empty storageList}">
					<tr align="center">
						<td height="25" colspan="9">
							暂无数据
						</td>
					</tr>
				</c:if>
				<tr align="center">
					<td height="25" colspan="9">
						共入库总数为:&nbsp;${result }
					</td>
				</tr>
			</table>
		</form>
	</body>
</html>